<?
require("config.php");

$location_status .= "| Edit";
$show_backnav = "menu";
$menuname = NULL;
$menutarget = NULL;

if (NULL!=$action){

	$dir = $table . "/";

	if ($Picture1) myUpload($Picture1,$Picture1_name,$dir);

	if ($Picture1_name == null) $Picture1_name = $bk_Picture1;


	if ($remove_1=="ture") $Picture1_name=NULL;

	$Date = "$Year-$Month-$Day";

   $field = array(
	"name", 
	"filename",
	);

   $content = array(
	$Name,
	$Picture1_name,
	);

	$exp = "id=$id";

   myUpdate($table,$field,$content,$exp);


   header("location:" . $rela_path . "share/msg.php?v=7322");

   exit();

}else{

  if (!checkRecord($table,$id)){

	header("location:" . $rela_path . "share/msg.php?v=9002");

	exit();
  
  }

}


$Query = "SELECT 
code,
name, 
filename 
FROM $table WHERE id=$id LIMIT 1";

$r=myQuery($Query);

$Code=$r[0][0];
$Name=$r[0][1];
$Picture1=$r[0][2];


require($rela_path . "inc/header.php");
require($rela_path . "bin/date.php");

?>



<form action="" method="post" enctype="multipart/form-data" name="form1">
<input name="action" type="hidden" value="edit">
<input name="Code" type="hidden" value="<?print($Code)?>">
<input name="bk_Picture1" type="hidden" value="<?print($Picture1)?>">





<table width="95%" border="0" align="center">
  <tr> 
    <td valign="top"> <table border="0" cellspacing="5" cellpadding="1">
          <tr> 
            <td>&nbsp;</td>
            <td>&nbsp;</td>
          </tr>
          <tr> 
            <td class="tdheader">Code : </td>
            <td><?print($Code)?></td>
          </tr>

          <tr> 
            <td class="tdheader">Name :</td>
            <td><input type="text" class="text" name="Name" size="56" value="<?print($Name)?>"></td>
          </tr>










          <tr> 
            <td class="tdheader">Picture 1</td>
            <td>
			
			<?removeImage($Picture1,"remove_1")?>
			
			<!--<br><b>(Normal Picture)</b><br>-->
			<?loadImage($Picture1,$rela_path . $PIC_DIR . "$table/")?> 
			<input type="file" class="text" name="Picture1" size="40">


            </td>
          </tr>


              </table></td>
          </tr>
          <tr> 
            <td>&nbsp;</td>
            <td>&nbsp;</td>
          </tr>
          <tr> 
            <td>&nbsp;</td>
            <td> <input type="image" src="../../images/bt_cancel.gif" onClick="Redirect('menu.php',1);return false;"> <input type="image" src="../../images/bt_save.gif">
            </td>
          </tr>
          <tr> 
            <td>&nbsp;</td>
            <td>&nbsp;</td>
          </tr>
        </table>

<br>
<br>
<br>


</form>

<?
require($rela_path . "inc/footer.php");
?>
